<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">

    <title>用户注册</title>
    <link type="text/css" rel="stylesheet" href="/src/common/cas.css" />
    <script type="text/javascript" src="/dep/jquery/jquery-1.9.1.min.js"></script>
    <script src="/dep/jquery/jquery.validate.js" type="text/javascript"></script>
    <script>
        function changeImg() {
            var imgSrc = $("#imgObj");
            var src = imgSrc.attr("src");
            imgSrc.attr("src", chgUrl(src));
        }
        function chgUrl(url) {
            var timestamp = (new Date()).valueOf();
            url = url.substring(0, 17);
            if ((url.indexOf("&") >= 0)) {
                url = url + "×tamp=" + timestamp;
            } else {
                url = url + "?timestamp=" + timestamp;
            }
            return url;
        }

        <%--$(document).ready(function () {--%>
            <%--$("#fm1").validate({--%>
                <%--rules: {--%>
                    <%--'username': {--%>
                        <%--required: true--%>
                    <%--},--%>
                    <%--'password': {--%>
                        <%--required: true--%>
                    <%--},--%>
                    <%--'repassword': {--%>
                        <%--required: true,--%>
                        <%--equalTo:"#password"--%>
                    <%--},--%>
                    <%--'email': {--%>
                        <%--required: true,--%>
                        <%--email: true--%>
                    <%--},--%>
                    <%--'code': {--%>
                        <%--required: true--%>
                    <%--}--%>
                <%--},--%>
                <%--messages: {--%>
                    <%--'username': {--%>
                        <%--required: "<spring:message code="screen.register.label.username"/>"--%>
                    <%--},--%>
                    <%--'password': {--%>
                        <%--required: "<spring:message code="screen.register.label.password"/>"--%>
                    <%--},--%>
                    <%--'repassword': {--%>
                        <%--required: "<spring:message code="screen.register.label.repassword"/>"--%>
                    <%--},--%>
                    <%--'email': {--%>
                        <%--required: "<spring:message code="screen.register.label.email"/>",--%>
                        <%--email: "<spring:message code="screen.register.label.email.check"/>"--%>
                    <%--},--%>
                    <%--'code':{--%>
                        <%--required:"<spring:message code="screen.register.label.code.min"/>"--%>
                    <%--}--%>
                <%--},--%>
                <%--submitHandler: function(form) {--%>
                    <%--console.log("验证码检验");--%>
                    <%--$.ajax({--%>
                        <%--type: "POST",--%>
                        <%--ContentType:"text/html",--%>
                        <%--dataType:"json",--%>
                        <%--url: 'check-register.html',--%>
                      <%--//  data: {code: $("#code").val()},--%>
                        <%--data:$('#fm1').serialize(),--%>
                        <%--success: function (data) {--%>
                            <%--if (data) {--%>
                                <%--form.submit();--%>
                            <%--}--%>
                        <%--}--%>
                    <%--});--%>
                <%--}--%>
            <%--});--%>
        <%--});--%>
    </script>
</head>
<body id="cas">
<div id="container">
    <div id="content">
        <div class="box" id="login">
            <form:form method="post" id="fm1" name="fm1" commandName="user" htmlEscape="true"
                       action="enter-register.html">
                <h2><spring:message code="screen.register.label.title"/></h2>
                <section class="row">
                    <label for="username"><spring:message code="screen.register.label.username"/></label>
                    <form:input path="username" />
                    <form:errors path="username" />
                </section>
                <section class="row">
                    <label for="password"><spring:message code="screen.register.label.password"/></label>
                    <form:password path="password" id="password"/>
                    <form:errors path="password" />
                </section>
                <section class="row">
                    <label for="password"><spring:message code="screen.register.label.repassword"/></label>
                    <input type="password" id="repassword" name="repassword"/>
                </section>
                <section class="row">
                    <label for="email"><spring:message code="screen.register.label.email"/></label>
                    <form:input path="email"/>
                    <form:errors path="email" />
                </section>
                <section class="row">
                    <label for="code"> <spring:message code="screen.register.label.code.min"/> </label>
                    <input id="code" name="code"/>
                </section >
                <section class="row">
                    <img id="imgObj"  src="/util/code.html" onclick="changeImg()"/>
                </section>
                <section class="row btn-row">
                    <input class="btn-submit" id="mysubmit"
                           value="<spring:message code="screen.register.button.submit" />" type="submit"/>
                    <input class="btn-reset"
                           value="<spring:message code="screen.welcome.button.clear" />" type="reset"/>
                </section>

            </form:form>
        </div>
    </div>
</div>

</body>
</html>